﻿using System;
using System.ComponentModel;
using MrCMS.DbConfiguration;

namespace MrCMS.Entities
{
    public abstract class SystemEntity
    {
        private Guid _guid;

        protected SystemEntity()
        {
            _guid = Guid.NewGuid();
        }

        public virtual int Id { get; set; }

        [NotNullable, ShouldMap]
        public virtual Guid Guid
        {
            get { return _guid; }
        }

        [DisplayName("Created On")]
        public virtual DateTime CreatedOn { get; set; }

        [DisplayName("Updated On")]
        public virtual DateTime UpdatedOn { get; set; }

        public virtual bool IsDeleted { get; set; }

        /// <summary>
        /// Only to be used for data import and the like. This is otherwise generated by the system.
        /// </summary>
        /// <param name="guid"></param>
        public virtual void SetGuid(Guid guid)
        {
            _guid = guid;
        }
    }
}